package com.weayer.service;

import com.weayer.dto.ResponseResult;
import com.weayer.remote.MapTerminalClient;
import com.weayer.response.AddTerminalResponse;
import com.weayer.response.SearchTerminalResponse;
import com.weayer.response.TrsearchResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description: 终端管理Service
 * @author: Weayer
 **/
@Service
public class TerminalService {
    @Autowired
    MapTerminalClient mapTerminalClient;

    /**
     * @Description: 根据终端的名称，调用api创建终端，获取tid
     * @Param: [name]
     * @return: com.weayer.dto.ResponseResult<com.weayer.response.TerminalResponse>
     **/
    public ResponseResult<AddTerminalResponse> add(String name, String desc){
        return mapTerminalClient.add(name, desc);
    }
    /**
     * @Description: 周边搜索终端
     * @Param: [center, radius]
     * @return: com.weayer.dto.ResponseResult<java.util.List<com.weayer.response.SearchTerminalResponse>>
     **/
    public ResponseResult<List<SearchTerminalResponse>> search(String center, Integer radius){
        return mapTerminalClient.search(center,radius);
    }

    /**
     * @Description: 查询轨迹
     * @Param: [tid, starttime, endtime]
     * @return: com.weayer.dto.ResponseResult
     **/
    public ResponseResult<TrsearchResponse> trsearch(String tid, Long starttime, Long endtime) {
        return mapTerminalClient.trsearch(tid, starttime, endtime);
    }
}
